package org.ch02.test05;

import org.ch02.entity.Student;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

/**
 * 其他 API
 * @author ZJL
 * @date 2025-03-18
 */
public class MainTest02 {
    public static void main(String[] args) throws Exception {
        Class<Student> clazz = Student.class;
        Field nameField = clazz.getDeclaredField("name");
        System.out.println(nameField);
        // 获取字段的访问修饰符
        int modifiers = nameField.getModifiers();
        System.out.println(Modifier.toString(modifiers));
        boolean aPrivate = Modifier.isPrivate(modifiers);
        System.out.println(aPrivate);
    }
}
